<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>流浪书客 图书城</title>
		<link type="text/css" rel="stylesheet" href="css/viewBook.css">
		<script type="text/javascript" src="/S5_BOOKSHOP_LHJ/fckeditor/fckeditor.js"></script>
		<script type="text/javascript">
	function showPic() {
		var selobj = document.getElementById("reviewImg");
		var imgobj = document.getElementById("touxiang");
		var path = "${CONTEXT_ROOT}/images/img/" + selobj.value + ".gif";
		imgobj.setAttribute("src", path);

	}
	<c:if test="${not empty member}">
	window.onload = function() {

		var sBasePath = "${CONTEXT_ROOT}/fckeditor/";
		var oFCKeditor = new FCKeditor('reviewContent');
		oFCKeditor.BasePath = sBasePath;
		oFCKeditor.Height = 270;
		//皮肤
		var sSkin = "office2003";
		var sSkinPath = sBasePath + 'editor/skins/' + sSkin + '/';
		oFCKeditor.Config['SkinPath'] = sSkinPath;

		oFCKeditor.ReplaceTextarea();
	}
	</c:if>
</script>
	</head>
	<body>
		<%@  include file="top.jsp"%>
		<div id="MIDDLE">
			<div class="position">
				<a href="index.jsp">首页</a>
				<c:if test="${not empty path}"> &nbsp; &gt;&nbsp; ${path} </c:if>
			</div>

			<!--左侧-->
			<div id="LEFT">
				<!-- 分类信息  -->
				<div id="category">

					<div id="categoryTitle">
						<!-- 标题  -->
						<div id="cateTitleName">
							相关图书推荐
						</div>
					</div>
					<c:set var="i" value="1"></c:set>
					<c:forEach items="${bookPageList.objectList}" var="books">
						<c:choose>
							<c:when test="${books.bookId==book.bookId}">
								<c:set var="i" value="${i+1}"></c:set>
							</c:when>

							<c:when test="${i1==null}">
								<div id="cateContent">
									<div class="cateOne">
										<div id="cateOneContent">
											<a
												href="${CONTEXT_ROOT}/SysBookServlet?method=viewBook&bookId=${books.bookId}&parentCategoryId=${books.categoryId}">${books.bookName}</a>
										</div>
									</div>
									<div
										style="width: 200px; text-align: center; height: 130px; line-height: 130px; verical-align: middle">
										<img src="${CONTEXT_ROOT}/upload/${books.bookImg}"
											height="110px" border="0">
									</div>

									<c:set var="i" value="${i+1}"></c:set>
									<c:set var="i1" value="${i}"></c:set>
								</div>
							</c:when>
							<c:otherwise>
								<div id="pubContent">
									<ol>
										<li>
											<a
												href="${CONTEXT_ROOT}/SysBookServlet?method=viewBook&bookId=${books.bookId}&parentCategoryId=${books.categoryId}">${books.bookName}</a>
										</li>
									</ol>
								</div>
							</c:otherwise>
						</c:choose>
					</c:forEach>
				</div>
				<!-- 浏览记录 -->
				<div id="category" style="margin-top: 10px;">

					<div id="categoryTitle">
						<!-- 标题  -->
						<div id="cateTitleName">
							您的浏览记录
						</div>
					</div>
					<div id="cateContent">
						<!--一级分类 class= cateOne-->

						<!--二级分类-->
						<div id="pubContent">
							<ol>
								<li>
									<a
										href="${CONTEXT_ROOT}/SecondServlet?method=list&parentCategoryId=${category.categoryId}">${category.categoryName}</a>
								</li>
							</ol>
						</div>
						<div style="text-align: center; margin-top: 10px;">
							<a href="#">清空浏览记录</a>
						</div>
					</div>
				</div>
			</div>

			<!-- 右侧 -->
			<div id="RIGHT">
				<div
					style="float: left;width: 682px; border-bottom: 1px dashed #9C9E6B; margin-bottom: 10px; text-align: left; font-family: 微软雅黑; font-size: 24px;">
					${book.bookName}
				</div>
				<div
					style="float: left; font-size: 16px; line-height: 31px; width: 100px; border-bottom: 1px dashed #9C9E6B;">
				<a href="javascript:history.go(-1);">返回</a>

				</div>
				<div class="bookContent">
					<!-- 书籍的信息 -->
					<table width="775px" border="0">
						<tr>
							<td rowspan="5" height="140px" align="center" valign="middle"
								width="21%">
								<a
									href="${CONTEXT_ROOT}/SysBookServlet?method=viewBook&bookId=${book.bookId}&parentCategoryId=${book.categoryId}"><img
										border="0" src="${CONTEXT_ROOT}/upload/${book.bookImg}"
										height="110px"> </a>
							</td>
							<td width="79%">
								市场价：
								<font color="#ff0000">￥${book.bookPrice}</font>元
							</td>
						</tr>
						<tr>
							<td>
								<c:forEach items="${gradeList}" var="grade">
									<c:if test="${member!=null}">
										<c:if test="${member.gradeId==grade.gradeId}">
								会员价：
								<font color="#ff0000">￥${book.bookPrice*grade.rebate/100}
											</font>元</c:if>
									</c:if>
								</c:forEach>
							</td>
						</tr>
						<tr>
							<td>
								学生优惠价：
								<font color="#ff0000">￥${book.bookPrice*0.85}</font>元
							</td>

						</tr>
						<tr>
							<td>
								出版社：${publish.publishName}
							</td>
						</tr>
						<tr>
							<td>
								<a href="${CONTEXT_ROOT}/ShoppingCartServlet?method=add&bookId=${book.bookId}">购买 </a><a href="#">收藏</a>
							</td>
						</tr>
					</table>
					<hr width="782px">
					<div class="info">
						【基本信息】
					</div>
					<table border="0" width="782px">
						<tr>
							<td width="17%" align="right">
								【作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;者】&nbsp;&nbsp;
							</td>
							<td width="83%" align="left">
								${book.bookAuthor}
							</td>
						</tr>
						<tr>
							<td align="right">
								【丛&nbsp;&nbsp;书&nbsp;&nbsp;名】&nbsp;&nbsp;
							</td>
							<td align="left">
								<a href="#">普通高等教育“十一五”国家级规划教材</a>
							</td>
						</tr>
						<tr>
							<td align="right">
								【出&nbsp;&nbsp;版&nbsp;&nbsp;社】&nbsp;&nbsp;
							</td>
							<td align="left">
								${publish.publishName}&nbsp;&nbsp;【书&nbsp;号】&nbsp;&nbsp;9787302185673
							</td>
						</tr>
						<tr>
							<td align="right">
								【上架时间】&nbsp;&nbsp;
							</td>
							<td align="left">
								2008-10-17
							</td>
						</tr>
						<tr>
							<td align="right">
								【出版日期】&nbsp;&nbsp;
							</td>
							<td align="left">
								${book.publishDate}
							</td>
						</tr>
						<tr>
							<td align="right">
								【所属分类】&nbsp;&nbsp;
							</td>
							<td align="left">
								${path}
							</td>
						</tr>
					</table>
					<div class="info">
						【内容简介】
					</div>
					<center>
						<table border="0" width="750px">
							<tr>
								<td width="100%" align="left">
									${book.bookInfo}
								</td>
							</tr>
						</table>
					</center>
					<div class="info">
						【图片评论】
					</div>
					<center>
						<table border="0" width="750px">
							<tr>
								<td width="25%">
									<font color="#339999">评论交流</font>
								</td>
								<td width="75%">
									${reviewPageList.pageStr}
								</td>
							</tr>
						</table>
						<table border="1px" width="600px" cellspacing="0" cellpadding="0" bordercolor="#7F9DB9">
							<c:forEach items="${reviewPageList.objectList}" var="review">
								<tr>
									<td width="25%" align="center" valign="middle" rowspan="2">
										<img src="${CONTEXT_ROOT}/images/img/${review.reviewImg}.gif"
											height="70px">
									</td>
									<td width="75%" align="right" height="20px">
										<font color="#999999">发表于：${review.reviewDate}&nbsp;&nbsp;&nbsp;&nbsp;</font>
									</td>
								</tr>
								<tr>
									<td align="left" height="80px" valign="top"
										style="padding: 5px;">
										${review.reviewContent}
									</td>
								</tr>
								<tr>
									<td colspan="2" style="height: 8px; background-color: #E3E9F1;">
										<br>
									</td>
								</tr>
							</c:forEach>
						</table>
						<br>
						${member==null?"您还没有登录，不能进行评论，请<a
						href='memberLogin.jsp'>登录</a>":""}
						<c:if test="${member!=null}">
							<form action="${CONTEXT_ROOT}/BookReviewServlet">

								<table border="0" width="750px">
									<tr>
										<td width="25%" align="left">
											<font color="#339999" size="3">添加评论</font>
										</td>
										<td width="75%">
											<br>
										</td>
									</tr>
								</table>
								<table width="772px">
									<tr>
										<td width="10%" align="right">
											头像：
										</td>
										<td width="20%" align="left">
											<select id="reviewImg" name="reviewImg"
												onChange="showPic(this)">
												<c:forEach var="i" begin="1" end="30">
													<option value="${i}">
														头像${i}
													</option>
												</c:forEach>
											</select>
										</td>
										<td width="70%" valign="middle" align="left">
											<img src="images/img/29.gif" id="touxiang" />
										</td>
									</tr>
									<tr>
										<td align="right" valign="top">
											内容：
										</td>
										<td colspan="2" align="left">
											<textarea name="reviewContent" id="reviewContent" cols="70"
												rows="7"></textarea>
										</td>
									</tr>
									<tr>
										<td colspan="3" align="center">
											<input type="submit" name="submit" value="提交评论">
											&nbsp;&nbsp;&nbsp;&nbsp;
											<input type="reset" name="reset" value="重置">
											<input type="hidden" name="parentCategoryId"
												value="${parentCategoryId }">
											<input type="hidden" name="bookId" value="${book.bookId}">
											<input type="hidden" name="path" value="${path}">
											<input type="hidden" name="memberId"
												value="${member.memberId}">
										</td>
									</tr>
								</table>
							</form>
						</c:if>
					</center>
				</div>
			</div>
		</div>
		<%@  include file="bottom.jsp"%>
	</body>
</html>